package com.songcha.library_base.compose

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.compose.foundation.layout.Box
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.ComposeView
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.songcha.library_base.R
import com.songcha.library_base.base.BaseActivity
import com.songcha.library_base.bean.BaseEditBean
import com.songcha.library_base.mvvm.base.BaseMvvmActivity
import com.songcha.library_base.mvvm.base.BaseRepository
import com.songcha.library_base.mvvm.base.BaseViewModel
import com.songcha.library_base.mvvm.edit.BaseEditViewModel
import com.songcha.library_base.mvvm.edit.IEditMvvmListener
import kotlinx.coroutines.launch
import java.lang.reflect.ParameterizedType

abstract class BaseComposeEditMvvmActivity<VM: BaseEditViewModel<out BaseRepository,out BaseEditBean>>:
    BaseComposeMvvmActivity<VM>(),IEditMvvmListener {
    override fun initObserver() {
        viewModel.editList.observe(this){data ->
            if(data != null)
                onEditListChange(data!! as MutableList<BaseEditBean>)
        }

        viewModel.isManage.observe(this){data ->
            onIsManageChange(data)
        }

        viewModel.isSelectAll.observe(this){data->
            onIsSelectAllChange(data)
        }

        viewModel.hasSelect.observe(this){data->
            onHasSelectChange(data)
        }
    }
}